package com.groot.medical.service;

import java.util.List;

import com.groot.medical.dao.ChronicExamineDAO;
import com.groot.medical.dao.ChronicExamineDAOImpl;
import com.groot.medical.entity.ChronicExpense;
import com.groot.medical.entity.PageBean;

public class ChronicExamineServiceImpl implements ChronicExamineService {
	
	private ChronicExamineDAO chronicExamineDAO = new ChronicExamineDAOImpl();

	@Override
	public PageBean findChronicExamineByPage(int pageNum, int pageSize, String name, String startTime,
			String endTime,String areacode,String ispass, String isremittance) {
		int totalRecord = chronicExamineDAO.getCounts(name,startTime,endTime,areacode,ispass,isremittance);
		System.out.println("条数"+totalRecord);
		PageBean pageBean = new PageBean<>(pageNum, pageSize, totalRecord);
		int startIndex = pageBean.getStartIndex();
		pageBean.setList(chronicExamineDAO.findChronicExamineByPage(startIndex,pageSize,name,startTime,endTime,areacode,ispass,isremittance));
		return pageBean;
	}

	@Override
	public PageBean statisticsChronicExpense(int pageNum, int pageSize, String name, String startTime, String endTime,
			String areacode, String illCode) {
		int totalRecord = chronicExamineDAO.getCountsforStatistics(name,startTime,endTime,areacode,illCode);
		PageBean pageBean = new PageBean<>(pageNum, pageSize, totalRecord);
		int startIndex = pageBean.getStartIndex();
		pageBean.setList(chronicExamineDAO.statisticsChronicExpense(startIndex,pageSize,name,startTime,endTime,areacode,illCode));
		return pageBean;
	}

	@Override
	public List<ChronicExpense> findByCondition(String name, String stratTime, String endTime, String areacode,
			String illCode) {
		List<ChronicExpense> expense = chronicExamineDAO.findByCondition(name,stratTime,endTime,areacode,illCode);
		return expense;
	}

}
